package sk.fiit.lulco.grafy;

/**
 * class for edge
 */
public class Edge extends Item {

	private Vertex vertex1 = null;
	
	private Vertex vertex2 = null;

	/**
	 * constructor
	 * 
	 * @param	Vertex	vertex1
	 * @param	Vertex	vertex2
	 */
	public Edge(Vertex vertex1, Vertex vertex2) {
		this.vertex1 = vertex1;
		this.vertex2 = vertex2;
	}
	
	/**
	 * checks if edge is conflicted
	 * 
	 * @return	boolean
	 */
	public boolean isConflicted() {
		if (this.vertex1.getColor() == this.vertex2.getColor() && this.vertex1.getId() != this.vertex2.getId()) {
			return true;
		} else if (this.vertex1.getColor() == 0 || this.vertex2.getColor() == 0) {
			return true;
		} else {
			return false;
		}
	}
	
	/**
	 * getter for first vertex
	 * 
	 * @return	Vertex
	 */
	public Vertex getVertex1() {
		return this.vertex1;
	}
	
	/**
	 * getter for second vertex
	 * 
	 * @return	Vertex
	 */
	public Vertex getVertex2() {
		return this.vertex2;
	}
}